#登录
import requests

from common.config import ip
from APIs.baseApi import BaseAPI


class LoginApi(BaseAPI):
    def login(self,z={"username":'admin', "password":'123456'}):
        # loginData = {"username":'admin', "password":'123456'}
        self.r = requests.post(f"{ip}/login", data=z)
        print(self.r.json())
        return self.r

    def loginOk(self):
        t=self.r.json()['code']
        return t
    def loginError(self):
        t=self.r.json()['code']
        return t

if __name__=='__main__':
    lg=LoginApi()
    rr=loginData = {"username":'admin', "password":'123456'}
    lg.login(rr)
    print(lg.loginOk())
    print(lg.loginError())